package com.mwy.controller;

import com.mwy.job.MyJob2;
import com.mwy.quartz.QuartzManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Controller1 {
    @Autowired
    private QuartzManager quartzManager;

    @RequestMapping("/show1")
    @ResponseBody
    public String show(){
        System.out.println("进入show1方法");
        quartzManager.addJob("job1","group1","trigger1",
                "group1", MyJob2.class,"0/3 * * * * ?");
        quartzManager.startAllJob();
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        quartzManager.changeJob("job1","group1","trigger1",
                "group1", MyJob2.class,"1/5 * * * * ?");
        return "年后好时光";
    }
}
